package com.androidx.p013lv.mine.model;

import android.content.Context;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.androidx.p013lv.base.http.BaseRes;
import com.androidx.p013lv.base.http.HttpUtils;
import com.androidx.p013lv.base.http.UrlManager;
import com.androidx.p013lv.base.http.callback.HttpCallback;
import com.androidx.p013lv.mine.bean.ProxyBean;
import com.androidx.p013lv.mine.bean.ReqProxyDetails;
import com.androidx.p013lv.mine.bean.WalletHistoryBean;
import com.google.gson.Gson;
import java.util.List;

/* renamed from: com.androidx.lv.mine.model.ProxyViewModel */
public class ProxyViewModel extends ViewModel {
    private MutableLiveData<BaseRes<ProxyBean>> proxyData;
    private MutableLiveData<BaseRes<List<WalletHistoryBean>>> proxyDetailsData;

    public MutableLiveData<BaseRes<List<WalletHistoryBean>>> dataProxyDetails() {
        if (this.proxyDetailsData == null) {
            this.proxyDetailsData = new MutableLiveData<>();
        }
        return this.proxyDetailsData;
    }

    public MutableLiveData<BaseRes<ProxyBean>> dataProxy(Context context) {
        if (this.proxyData == null) {
            this.proxyData = new MutableLiveData<>();
            getProxyData(context);
        }
        return this.proxyData;
    }

    private void getProxyData(Context context) {
        HttpUtils.getInsatance().post(UrlManager.getInsatance().proxyData(), new HttpCallback<BaseRes<ProxyBean>>("proxyData", context) {
            /* class com.androidx.p013lv.mine.model.ProxyViewModel.C13631 */

            public void onLvSuccess(BaseRes<ProxyBean> baseRes) {
                ProxyViewModel.this.proxyData.setValue(baseRes);
            }
        });
    }

    public void getProxyDetails(String str) {
        HttpUtils.getInsatance().post(UrlManager.getInsatance().proxyDataInfo(), new Gson().toJson(new ReqProxyDetails(str, 30)), new HttpCallback<BaseRes<List<WalletHistoryBean>>>("proxyDataInfo") {
            /* class com.androidx.p013lv.mine.model.ProxyViewModel.C13642 */

            public void onLvSuccess(BaseRes<List<WalletHistoryBean>> baseRes) {
                ProxyViewModel.this.proxyDetailsData.setValue(baseRes);
            }
        });
    }

    public void cancelHttp() {
        HttpUtils.getInsatance().cancelTag("proxyData");
        HttpUtils.getInsatance().cancelTag("proxyDataInfo");
    }
}
